怎麼檢查 object 是不是空的?


Posted by Rich on 2021-09-12

有時候會有這種需求,這次解決的幫手是:

let obj = {}
if (Object.keys(obj).length === 0) //true

怕忘記,紀錄一下。










Related Posts

[Release Notes] 20210204_v1 - Add explore page

[Release Notes] 20210204_v1 - Add explore page

[ 筆記 ] React 03 - Functional Componet & Component 之間的溝通

[ 筆記 ] React 03 - Functional Componet & Component 之間的溝通

Advanced iOS App Architecture (Second Edition): Real-World App Architecture in Swift

Advanced iOS App Architecture (Second Edition): Real-World App Architecture in Swift


Comments